<%@ page import="bean.Goods" %>
<%@ page import="dao.GoodsDao" %>
<%@ page import="bean.People" %>
<%@ page import="java.util.List" %>
<%@ page import="dao.PeopleDao" %>
<%@ page import="bean.Area" %>
<%@ page import="dao.AreaDao" %>
<%@ page import="bean.Status" %>
<%@ page import="dao.StateDao" %><%--
  Created by IntelliJ IDEA.
  User: young
  Date: 2017/6/28
  Time: 19:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta content="" name="description"/>
    <meta content="webthemez" name="author"/>
    <title>物流管理系统</title>
    <!-- Bootstrap Styles-->
    <link href="assets/css/bootstrap.css" rel="stylesheet"/>
    <!-- FontAwesome Styles-->
    <link href="assets/css/font-awesome.css" rel="stylesheet"/>
    <!-- Morris Chart Styles-->
    <link href="assets/js/morris/morris-0.4.3.min.css" rel="stylesheet"/>
    <!-- Custom Styles-->
    <link href="assets/css/custom-styles.css" rel="stylesheet"/>
    <!-- Google Fonts-->
    <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'/>
    <link rel="stylesheet" href="assets/js/Lightweight-Chart/cssCharts.css">
</head>
<body>
<jsp:include page="header.jsp"/>

<%----%>
<%
    int id = Integer.parseInt(request.getParameter("id"));
    GoodsDao goodsDao = new GoodsDao();
    Goods goods = goodsDao.getGoods(id);
%>
<%----%>

<div id="wrapper">
    <jsp:include page="header.jsp"/>
    <!--/. NAV TOP  -->
    <nav class="navbar-default navbar-side" role="navigation">
        <div class="sidebar-collapse">
            <ul class="nav" id="main-menu">
                <li>
                    <a class="active-menu" href="index.jsp"><i class="fa fa-dashboard"></i> 主控制面板</a>
                </li>
                <li>
                    <a href="peopleManger.jsp"><i class="glyphicon glyphicon-user"></i> 人员管理</a>
                </li>

                <li>
                    <a href="salaryManager.jsp"><i class="fa fa-sitemap"></i> 薪水管理</a>
                <li>
                    <a href="taskManager.jsp"><i class="fa fa-qrcode"></i> 任务管理</a>
                </li>

                <li>
                    <a href="areaManager.jsp"><i class="fa fa-table"></i> 区域管理</a>
                </li>
                <li>
                    <a href="stateManager.jsp"><i class="fa fa-edit"></i> 状态管理 </a>
                </li>
            </ul>

        </div>

    </nav>
    <!-- /. NAV SIDE  -->

    <div id="page-wrapper">
        <div class="header">
            <h1 class="page-header">
                主控制面板
                <small>欢迎使用物流管理系统</small>
            </h1>
        </div>
        <div id="page-inner">
            <div class="row">

                <%----%>
                <div class="col-md-12">
                    <form action="updateGoods?id=<%=id%>" class="form-group"
                          method="post">
                        <div class="modal-body">
                            <%--表单信息--%>
                            <div class="form-group">
                                <label for="goodId">货物编号</label>
                                <input type="number" class="form-control" id="goodId"
                                       name="goodId" value="<%=goods.getId()%>"
                                       placeholder="货物编号" readonly="readonly">
                            </div>
                            <div class="form-group">
                                <label for="updateName">货物名称</label>
                                <input type="text" class="form-control" id="updateName"
                                       name="goodsName" value="<%=goods.getName()%>"
                                       placeholder="货物名称">
                            </div>
                            <div class="form-group">
                                <label for="updateSummary">货物介绍</label>
                                <input type="text" class="form-control"
                                       id="updateSummary" name="Summary"
                                       value="<%=goods.getSummary()%>"
                                       placeholder="货物介绍">
                            </div>
                            <label>送货人员</label>
                            <select id="updatePeople" class="select show form-control"
                                    name="peopleId">
                                <%
                                    PeopleDao peopleDao = new PeopleDao();
                                    List<People> peopleList = peopleDao.peopleList();
                                    for (People people : peopleList
                                            ) {
                                %>
                                <option value="<%=people.getId()%>"><%=people.getName()%>
                                </option>
                                <%}%>
                            </select>
                            <div>
                                <label>区域</label>
                                <select id="updateArea" class="select show form-control"
                                        name="areaId">
                                    <%
                                        AreaDao areaDao = new AreaDao();
                                        List<Area> areaList = areaDao.areaList();
                                        for (Area area : areaList
                                                ) {
                                    %>
                                    <option value="<%=area.getId()%>"><%=area.getName()%>
                                    </option>
                                    <%
                                        }
                                    %>
                                </select>
                            </div>

                            <div>
                                <label>货物状态</label>
                                <select id="updateState" class="select show form-control"
                                        name="stateId">
                                    <%

                                        StateDao stateDao = new StateDao();
                                        List<Status> statusList = stateDao.stateList();
                                        for (Status status : statusList
                                                ) {
                                    %>
                                    <option value="<%=status.getId()%>"><%=status.getState()%>
                                    </option>
                                    <%
                                        }
                                    %>
                                </select>
                            </div>

                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default"
                                    data-dismiss="modal">
                                关闭
                            </button>
                            <button type="submit" class="btn btn-primary">
                                更新
                            </button>
                        </div>

                    </form>
                </div>
                <%----%>

            </div>
        </div>
    </div>
</div>
</body>
</html>
